import 'package:fish_redux/fish_redux.dart';
import 'package:flutter/material.dart';
import '../../../app_files.dart';
import 'action.dart';
import 'state.dart';

Widget buildView(
    FeedbackViewState state, Dispatch dispatch, ViewService viewService) {
  return Scaffold(
    appBar: myAppBar(viewService.context, title: '意见反馈'),
    backgroundColor: ThemeConfig.separeColor,
    resizeToAvoidBottomPadding: false,
    body: GestureDetector(
      behavior: HitTestBehavior.translucent,
      onTap: () => CommonUtils.closeKey(viewService.context),
      child: SingleChildScrollView(
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: <Widget>[
            Container(
              color: Colors.white,
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  Padding(
                    padding: EdgeInsets.only(left: 15, top: 15),
                    child: Text(
                      '反馈内容',
                      style: TextThemeConfig.Font15WithColor22,
                    ),
                  ),
                  Container(
                    height: 130,
                    width: double.infinity,
                    margin: EdgeInsets.only(left: 12, top: 8, right: 20),
                    padding: EdgeInsets.only(left: 6, right: 4, top: 6),
                    decoration: BoxDecoration(
                      color: Colors.white,
                    ),
                    child: TextField(
                      controller: state.contentController,
                      style: TextStyle(
                          fontSize: 14, color: ThemeConfig.blackColor),
                      maxLines: 10,
                      decoration: InputDecoration(
                        border: InputBorder.none,
                        hintText: "请您如实填写反馈意见的内容",
                        hintStyle: TextStyle(fontSize: 14),
                        contentPadding: EdgeInsets.only(bottom: 13),
                      ),
                    ),
                  ),
                ],
              ),
            ),
            Container(
              width: double.infinity,
              height: 10,
              color: ThemeConfig.separeColor,
            ),
            Container(
              color: Colors.white,
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  Padding(
                    padding: EdgeInsets.only(left: 15, top: 15),
                    child: Text(
                      '联系方式（选填，便于我们与你联系）',
                      style: TextThemeConfig.Font15WithColor22,
                    ),
                  ),
                  Container(
                    width: double.infinity,
                    margin: EdgeInsets.only(left: 12, top: 8, right: 20),
                    padding: EdgeInsets.only(left: 6, right: 4),
                    decoration: BoxDecoration(
                      color: Colors.white,
                      borderRadius: BorderRadius.all(Radius.circular(8)),
                    ),
                    child: TextField(
                      controller: state.contactController,
                      style: TextStyle(
                          fontSize: 14, color: ThemeConfig.blackColor),
                      keyboardType: TextInputType.phone,
                      decoration: InputDecoration(
                        border: InputBorder.none,
                        hintText: "请输入手机号码",
                        hintStyle: TextStyle(fontSize: 14),
                        contentPadding: EdgeInsets.only(bottom: 3),
                      ),
                    ),
                  ),
                ],
              ),
            ),
            Container(
              margin: EdgeInsets.only(left: 15, right: 15, top: 100),
              height: 50,
              decoration: BoxDecoration(
                borderRadius: BorderRadius.all(Radius.circular(4)),
                color: ThemeConfig.mainColor,
              ),
              child: InkWell(
                child: Center(
                  child: Text(
                    '提交',
                    style: TextThemeConfig.Font16WithWhite,
                  ),
                ),
                onTap: () => dispatch(FeedbackViewActionCreator.onSubmit()),
              ),
            ),
          ],
        ),
      ),
    ),
  );
}
